<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>lacewing.server.ServerFactory</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="lacewing-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://mp2.dk">Python Lacewing Library</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="lacewing-module.html">Package&nbsp;lacewing</a> ::
        <a href="lacewing.server-module.html">Module&nbsp;server</a> ::
        Class&nbsp;ServerFactory
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="lacewing.server.ServerFactory-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class ServerFactory</h1><p class="nomargin-top"><span class="codelink"><a href="lacewing.server-pysrc.html#ServerFactory">source&nbsp;code</a></span></p>
<pre class="base-tree">
  twisted.internet.protocol.Factory --+    
                                      |    
twisted.internet.protocol.ServerFactory --+
                                          |
                                         <strong class="uidshort">ServerFactory</strong>
</pre>

<hr />
<p>The server factory.</p>

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Instance Methods</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="lacewing.server.ServerFactory-class.html#startFactory" class="summary-sig-name">startFactory</a>(<span class="summary-sig-arg">self</span>)</span><br />
      This will be called before I begin listening on a Port or Connector.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="lacewing.server-pysrc.html#ServerFactory.startFactory">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="globalPing"></a><span class="summary-sig-name">globalPing</span>(<span class="summary-sig-arg">self</span>)</span><br />
      Pings all clients currently connected to the server</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="lacewing.server-pysrc.html#ServerFactory.globalPing">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">str</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="lacewing.server.ServerFactory-class.html#getWelcomeMessage" class="summary-sig-name">getWelcomeMessage</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">connection</span>)</span><br />
      This method is called when a connection has been accepted, and a 
      welcome message has to be sent.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="lacewing.server-pysrc.html#ServerFactory.getWelcomeMessage">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="createChannel"></a><span class="summary-sig-name">createChannel</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">name</span>,
        <span class="summary-sig-arg">hidden</span>,
        <span class="summary-sig-arg">autoClose</span>,
        <span class="summary-sig-arg">master</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="lacewing.server-pysrc.html#ServerFactory.createChannel">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="destroyChannel"></a><span class="summary-sig-name">destroyChannel</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">channel</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="lacewing.server-pysrc.html#ServerFactory.destroyChannel">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="lacewing.server.ServerFactory-class.html#channelRemoved" class="summary-sig-name">channelRemoved</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">channel</span>)</span><br />
      Called when a channel has no users in it, and is therefore removed.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="lacewing.server-pysrc.html#ServerFactory.channelRemoved">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="lacewing.server.ServerFactory-class.html#channelAdded" class="summary-sig-name">channelAdded</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">channel</span>)</span><br />
      Called when a new channel is created.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="lacewing.server-pysrc.html#ServerFactory.channelAdded">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>twisted.internet.protocol.Factory</code></b>:
      <code>__providedBy__</code>,
      <code>__provides__</code>,
      <code>buildProtocol</code>,
      <code>doStart</code>,
      <code>doStop</code>,
      <code>stopFactory</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== CLASS VARIABLES ==================== -->
<a name="section-ClassVariables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Class Variables</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="datagram"></a><span class="summary-name">datagram</span> = <code title="None">None</code><br />
      hash(x)
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>twisted.internet.protocol.Factory</code></b>:
      <code>__implemented__</code>,
      <code>noisy</code>,
      <code>numPorts</code>,
      <code>protocol</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== INSTANCE VARIABLES ==================== -->
<a name="section-InstanceVariables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Instance Variables</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="lacewing.server.ServerChannel-class.html" class="summary-name">channelClass</a><br />
      This is the channel class that will be used when creating a new 
      channel.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="lacewing.server.ServerFactory-class.html#timeOut" class="summary-name">timeOut</a> = <code title="8">8</code><br />
      The number of seconds the client has to send a Hello packet before 
      being disconnected.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="pingTime"></a><span class="summary-name">pingTime</span> = <code title="8">8</code><br />
      The interval between pings in seconds
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="lacewing.server.ServerFactory-class.html#maxPing" class="summary-name">maxPing</a> = <code title="None">None</code><br />
      This is the time the client has to respond to pings (in seconds).
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="maxUsers"></a><span class="summary-name">maxUsers</span> = <code title="1000">1000</code><br />
      The max number of users allowed on the server.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="lacewing.server.ServerFactory-class.html#welcomeMessage" class="summary-name">welcomeMessage</a> = <code title="'Welcome! Server is running pylacewing 1.0.1 (win32)'"><code class="variable-quote">'</code><code class="variable-string">Welcome! Server is running pylacewing 1.0.1 </code><code class="variable-ellipsis">...</code></code><br />
      The message sent to accepted clients.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="ping"></a><span class="summary-name">ping</span> = <code title="True">True</code><br />
      If True, pinging will be enabled on the server
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="channelListing"></a><span class="summary-name">channelListing</span> = <code title="True">True</code><br />
      If True, channelListing is enabled on the server
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="masterRights"></a><span class="summary-name">masterRights</span> = <code title="False">False</code><br />
      If True, this enables the autoclose feature for clients when creating
      channels
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Method Details</span></td>
</tr>
</table>
<a name="startFactory"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">startFactory</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="lacewing.server-pysrc.html#ServerFactory.startFactory">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>This will be called before I begin listening on a Port or 
  Connector.</p>
  <p>It will only be called once, even if the factory is connected to 
  multiple ports.</p>
  <p>This can be used to perform 'unserialization' tasks that are best put 
  off until things are actually running, such as connecting to a database, 
  opening files, etcetera.</p>
  <dl class="fields">
    <dt>Overrides:
        twisted.internet.protocol.Factory.startFactory
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="getWelcomeMessage"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">getWelcomeMessage</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">connection</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="lacewing.server-pysrc.html#ServerFactory.getWelcomeMessage">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>This method is called when a connection has been accepted, and a 
  welcome message has to be sent. The default implementation just returns 
  <a href="lacewing.server.ServerFactory-class.html#welcomeMessage" 
  class="link">welcomeMessage</a>, but override this method to change that 
  behaviour.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>connection</code></strong> (<a href="lacewing.server.ServerProtocol-class.html" 
          class="link">ServerProtocol</a> object) - Connection that has been accepted</li>
    </ul></dd>
    <dt>Returns: str</dt>
  </dl>
</td></tr></table>
</div>
<a name="channelRemoved"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">channelRemoved</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">channel</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="lacewing.server-pysrc.html#ServerFactory.channelRemoved">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Called when a channel has no users in it, and is therefore 
  removed.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>channel</code></strong> - The channel that is being removed.</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="channelAdded"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">channelAdded</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">channel</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="lacewing.server-pysrc.html#ServerFactory.channelAdded">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Called when a new channel is created.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>channel</code></strong> - The channel that has been created.</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== INSTANCE VARIABLE DETAILS ==================== -->
<a name="section-InstanceVariableDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Instance Variable Details</span></td>
</tr>
</table>
<a name="channelClass"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">channelClass</h3>
  This is the channel class that will be used when creating a new channel. 
  Subclass <a href="lacewing.server.ServerChannel-class.html" 
  class="link">ServerChannel</a> and replace this attribute if you want to 
  change the behaviour of channels.
  <dl class="fields">
  </dl>
  <dl class="fields">
    <dt>Value:</dt>
      <dd><a href="lacewing.server.ServerChannel-class.html">lacewing.server.ServerChannel</a></dd>
  </dl>
</td></tr></table>
</div>
<a name="timeOut"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">timeOut</h3>
  The number of seconds the client has to send a Hello packet before being 
  disconnected. Can be a number or None for no timeout
  <dl class="fields">
  </dl>
  <dl class="fields">
    <dt>Value:</dt>
      <dd><table><tr><td><pre class="variable">
8
</pre></td></tr></table>
</dd>
  </dl>
</td></tr></table>
</div>
<a name="maxPing"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">maxPing</h3>
  This is the time the client has to respond to pings (in seconds). Can be 
  a number or None for no max ping (default)
  <dl class="fields">
  </dl>
  <dl class="fields">
    <dt>Value:</dt>
      <dd><table><tr><td><pre class="variable">
None
</pre></td></tr></table>
</dd>
  </dl>
</td></tr></table>
</div>
<a name="welcomeMessage"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">welcomeMessage</h3>
  The message sent to accepted clients.
  <dl class="fields">
  </dl>
  <dl class="fields">
    <dt>Value:</dt>
      <dd><table><tr><td><pre class="variable">
<code class="variable-quote">'</code><code class="variable-string">Welcome! Server is running pylacewing 1.0.1 (win32)</code><code class="variable-quote">'</code>
</pre></td></tr></table>
</dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="lacewing-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://mp2.dk">Python Lacewing Library</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Thu Dec 22 06:19:59 2011
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
